Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dom-walk

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-walk

iteratively walk a DOM node

  • 0.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.1M
increased by9.06%
Maintainers
1
Weekly downloads
 
Created

What is dom-walk?

The dom-walk npm package is a utility for traversing and manipulating the DOM (Document Object Model) in a simple and efficient manner. It allows developers to walk through the DOM tree, either up or down, and apply functions or retrieve information from the DOM elements.

What are dom-walk's main functionalities?

Walking the DOM tree

This feature allows you to traverse all nodes within a specified DOM element (e.g., document.body). The function passed to walk will be called with each node as it is visited.

var walk = require('dom-walk');
var elements = [];
walk(document.body, function (node) {
  elements.push(node);
});

Collecting specific elements

This code demonstrates how to use dom-walk to collect all input elements from the DOM. It walks through the DOM and conditionally pushes nodes that are input elements into an array.

var walk = require('dom-walk');
var inputs = [];
walk(document.body, function (node) {
  if (node.tagName === 'INPUT') {
    inputs.push(node);
  }
});

Other packages similar to dom-walk

FAQs

Package last updated on 03 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc